package com.nd.android.u.filestoragesystem.business.com;

import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.message.BasicHeader;

import android.util.Log;
import com.common.StarAppConfig;
import com.common.android.utils.httpRequest.ISetHeadAgent;
import com.product.android.business.ApplicationVariable;
import com.product.android.business.config.Configuration;
/**
 * 文件http请求header
 * 
 * <br>Created 2014-6-12 上午9:59:00
 * @version  
 * @author   huangszh		
 *
 * @see
 */
public class FileRequestHeader implements ISetHeadAgent{

    @Override
    public void setHttpHeader(HttpRequestBase request) {
    	request.removeHeaders("COOKIE");
        request.addHeader(new BasicHeader("COOKIE", "PHPSESSID="+ApplicationVariable.INSTANCE.getLocalSid())); 
    	// 会话SESSIONID
        request.addHeader(new BasicHeader("SID", 
        		ApplicationVariable.INSTANCE.getLocalSid()));
        
        // 明星标签ID 
        request.addHeader(new BasicHeader("TAGID",String.valueOf(Configuration.TAG_ID)));
        
        // 当前登录的用户ID 
        request.addHeader(new BasicHeader("CUID",  
                String.valueOf(ApplicationVariable.INSTANCE.getOapUid())));
        // 客户端类型
        request.addHeader(new BasicHeader("CLIENTTYPE","Android"));
        // 应用ID
        request.addHeader(new BasicHeader("APPID",  String.valueOf(Configuration.OAP_APPID)));
        // 云ID
        request.removeHeaders("CLOUDID");
        request.addHeader(new BasicHeader("CLOUDID", Configuration.CLOUNDID)); 
        request.addHeader(new BasicHeader("apikey", StarAppConfig.getConfig(StarAppConfig.CONFIG_API_KEY)));
        // 兼容旧的微博header
        request.addHeader(new BasicHeader("WEIBO-API-KEY",Configuration.WEIBO_APP_KEY));
    	request.addHeader(new BasicHeader("WEIBO-API-SECRET",Configuration.WEIBO_APP_SECRET));
        request.addHeader(new BasicHeader("UAP-SID", ApplicationVariable.INSTANCE.getLocalSid()));
        
        // 接口的参数需要以对象的形式传到中间层，就必须声明这个Content-Type
//        request.addHeader(new BasicHeader("Content-Type", "application/json"));

		// 定位问题的Log，这里暂时不要删除
//		Log.e("HYK",
//		"===========================================================================");
//		Log.e("HYK", request.getHeaders("COOKIE")[0].toString());
//		Log.e("HYK", request.getHeaders("SID")[0].toString());
//		Log.e("HYK", request.getHeaders("TAGID")[0].toString());
//		Log.e("HYK", request.getHeaders("CUID")[0].toString());
//		Log.e("HYK", request.getHeaders("CLIENTTYPE")[0].toString());
//		Log.e("HYK", request.getHeaders("APPID")[0].toString());
//		Log.e("HYK", request.getHeaders("CLOUDID")[0].toString());
//		Log.e("HYK", request.getHeaders("apikey")[0].toString());
//		Log.e("HYK", request.getHeaders("WEIBO-API-KEY")[0].toString());
//		Log.e("HYK", request.getHeaders("WEIBO-API-SECRET")[0].toString());
//		Log.e("HYK", request.getHeaders("UAP-SID")[0].toString());
//		Log.e("HYK", request.getHeaders("Content-Type")[0].toString());
//		Log.e("HYK",
//		"===========================================================================");
        
    }

}
